using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class ICClassTypeEntryMap : EntityTypeConfiguration<ICClassTypeEntry>
    {
        public ICClassTypeEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FIndex, t.FParentID });

            // Properties
            this.Property(t => t.FIndex)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FParentID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FTableName)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FKeyField)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FDescription_CHS)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.FDescription_CHT)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.FDescription_EN)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.FFilter)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FContainer)
                .IsRequired()
                .HasMaxLength(60);

            // Table & Column Mappings
            this.ToTable("ICClassTypeEntry");
            this.Property(t => t.FIndex).HasColumnName("FIndex");
            this.Property(t => t.FParentID).HasColumnName("FParentID");
            this.Property(t => t.FTableName).HasColumnName("FTableName");
            this.Property(t => t.FLeft).HasColumnName("FLeft");
            this.Property(t => t.FTop).HasColumnName("FTop");
            this.Property(t => t.FWidth).HasColumnName("FWidth");
            this.Property(t => t.FHeight).HasColumnName("FHeight");
            this.Property(t => t.FLayer).HasColumnName("FLayer");
            this.Property(t => t.FEntryType).HasColumnName("FEntryType");
            this.Property(t => t.FTabIndex).HasColumnName("FTabIndex");
            this.Property(t => t.FMustInput).HasColumnName("FMustInput");
            this.Property(t => t.FKeyField).HasColumnName("FKeyField");
            this.Property(t => t.FDescription_CHS).HasColumnName("FDescription_CHS");
            this.Property(t => t.FDescription_CHT).HasColumnName("FDescription_CHT");
            this.Property(t => t.FDescription_EN).HasColumnName("FDescription_EN");
            this.Property(t => t.FFilter).HasColumnName("FFilter");
            this.Property(t => t.FUserDefine).HasColumnName("FUserDefine");
            this.Property(t => t.FContainer).HasColumnName("FContainer");
            this.Property(t => t.FCanSort).HasColumnName("FCanSort");
        }
    }
}
